package com.sevilla28.app;

import org.apache.cordova.DroidGap;

import android.os.Bundle;
import android.os.Process;
import android.webkit.WebView;

import com.sevilla28.modelado.Coro;

public class MainActivity extends DroidGap {
	
	WebView webView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
    	super.onCreate(savedInstanceState);
    	//Cargando DroidGap
        super.init(); 
        //Habilitamos javascript y una interfaz para poder llamar al codigo desde el html
        super.appView.getSettings().setJavaScriptEnabled(true);
		appView.addJavascriptInterface(new CantoralHTML(getApplicationContext(), getActivity()), "Cantoral");
		appView.addJavascriptInterface(new Coro(getApplicationContext()), "Coro");
		//Cargamos la pagina principal
        super.loadUrl("file:///android_asset/www/sevilla28.html");
    	
    	//Cargando un webview normal
//    	webView =  new WebView(getApplicationContext());
//    	webView.getSettings().setJavaScriptEnabled(true);
//    	webView.setBackgroundColor(Color.parseColor("#FF9C2B"));
//    	webView.setVerticalScrollBarEnabled(false);
//    	webView.addJavascriptInterface(new CantoralHTML(getApplicationContext(), getParent()), "Cantoral");
//    	webView.loadUrl("file:///android_asset/www/sevilla28.html");
//    	setContentView(webView);   
    }
    
    @Override
    public void onBackPressed() {
    	Process.killProcess(Process.myPid());
    }
}
